package util

import (
	"github.com/astaxie/beego/context"
	"strconv"
)

func IsNum(value string) bool {
	_, err := strconv.ParseInt(value, 10, 64)
	if err != nil {
		return false
	}
	return true
}

//全局过滤器
var FilterUser = func(this *context.Context) {
	if this.Request.RequestURI == "/" {
	} else {
		if this.Request.URL.Path != "/login" {
			ses := this.Input.Session("roleName")
			if ses == nil || ses != "test" {
				this.Redirect(302, "/")
			}
		}

	}
}
